/*
 * OREKIT-X
 * Copyright 2002-2008 CS Communication & Systemes
 * 
 * Parts of this software package have been licensed to CS
 * Communication & Systemes (CS) under one or more contributor license
 * agreements.  See the NOTICE file distributed with this work for
 * additional information.
 *  
 * This is an experimental copy of OREKIT from www.orekit.org.
 * Please use the original OREKIT from orekit.org for normal work
 * unrelated to this research project.
 * 
 * Licensed under the Apache License, Version 2.0 (the "License"); you
 * may not use this file except in compliance with the License.  You
 * may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
 * implied.  See the License for the specific language governing
 * permissions and limitations under the License.
 */
package ore.frames;

import ore.errors.OrekitException;
import ore.time.AbsoluteDate;

/** 
 * Earth Orientation Parameters IAU1980
 * 
 * @author Pascal Parraud
 */
public class EOP1980History
    extends EOPHistory
{

    private static final String EOPC04FILENAME = "^eopc04\\.(\\d\\d)$";
    private static final String BULLETFILENAME = "^bulletinb((-\\d\\d\\d\\.txt)|(\\.\\d\\d\\d))$";


    public EOP1980History() throws OrekitException {
        super();

        new ore.io.EOP05C04FilesLoader(EOPC04FILENAME,this);
        new ore.io.BulletinBFilesLoader(BULLETFILENAME,this);
        this.checkEOPContinuity(Continuity);
        EOPHistory.Instance = this;
    }


    /** 
     * Get the UT1-UTC value.  The data provided comes from the IERS
     * files. It is smoothed data.
     * 
     * @param date Date at which the value is desired
     * 
     * @return UT1-UTC in seconds (0 if date is outside covered range)
     */
    public double getUT1MinusUTC(AbsoluteDate date) {

        return this.getInterpolatedField(date, EOP.Field.ut1utc);
    }
    /**
     * Get the LoD (Length of Day) value.  The data provided comes
     * from the IERS files. It is smoothed data.
     * 
     * @param date Date at which the value is desired
     * 
     * @return LoD in seconds (0 if date is outside covered range)
     */
    public double getLOD(AbsoluteDate date) {

        return this.getInterpolatedField(date, EOP.Field.lod);
    }
    /**
     * Get the correction to the nutation parameters.  The data
     * provided comes from the IERS files. It is smoothed data.
     * 
     * @param date Date at which the correction is desired
     * 
     * @return Nutation correction, may be the {@link
     * NutationCorrection#NULL_CORRECTION} if date is outside covered
     * range
     */
    public NutationCorrection getNutationCorrection(AbsoluteDate date) {

        return new NutationCorrection(this.getInterpolatedField(date, EOP.Field.ddeps),
                                      this.getInterpolatedField(date, EOP.Field.ddpsi));
    }
}
